#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS

rust_cpu = $(subst i586,i686,$(1))
DEB_HOST_RUST_TYPE := $(call rust_cpu,$(DEB_HOST_GNU_CPU))-unknown-$(DEB_HOST_GNU_SYSTEM)
DEB_TARGET_RUST_TYPE := $(call rust_cpu,$(DEB_TARGET_GNU_CPU))-unknown-$(DEB_TARGET_GNU_SYSTEM)

# Cargo looks for config in and writes cache to $CARGO_HOME/
export CARGO_HOME = $(CURDIR)/.cargohome
# Ask cargo to be verbose when building
export VERBOSE = 1

DEB_DESTDIR := $(CURDIR)/debian/tmp
VENDORDIR := $(CURDIR)/vendor
INDEXDIR := $(CURDIR)/vendor/index
DEPSDIR := $(CURDIR)/deps

%:
	dh $@

override_dh_auto_build:
	cargo build --release

override_dh_auto_clean:
	cargo clean
	rm -rf "$(CARGO_HOME)"

override_dh_auto_install:
	# We pick stuff directly from target/
